package com.workflow.server.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;
@Slf4j
@Configuration
public class DatabaseConfig {

    @Bean
    public DatabaseIdProvider databaseIdProvider() {
        Properties properties = new Properties();

        properties.setProperty("Oracle", "oracle");
        properties.setProperty("MySQL", "mysql");
        log.info("数据库的DatabaseId设置信息如下：{}", properties);

        DatabaseIdProvider vendorDatabaseIdProvider = new VendorDatabaseIdProvider();
        vendorDatabaseIdProvider.setProperties(properties);
        return vendorDatabaseIdProvider;
    }
}
